<?php

/*
 * @author chenshubo
 */
namespace app\command;
use think\console\Command;
use app\Normal;
use app\common\service\SystemRabbitMqService\MessageService\YunCangMessageService;
class YunCangMessageMQ extends Command
{
    protected function configure(){
        $this->setName('YunCangMessageMQ')//命令
        ->setDescription("云仓MQ消费中心");//描述
    }
    protected function execute(\think\console\Input $input, \think\console\Output $output)
    {
        while ( true )
        {
            try {
                (new YunCangMessageService())->consumer();
            } catch ( \Exception $e ) {
                $res = Normal::returnCode(Normal::FAIL,$e->getMessage().$e->getLine().$e->getFile());
                $time = time();
                $output->writeln("运行时间：". date('Y-m-d H:i:s',$time));
                $output->writeln("运行结果：". json_encode($res,JSON_UNESCAPED_UNICODE));
                sleep(10);
            }
        }
    }
}
